package com.py.credit.entity.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.py.credit.entity.common.OptionalColumn;

public enum DeclarationManagementEnum {
	TYPE("type", "申报类型", "varchar", true, "input", true, new HashMap<String, String>(), true,
			true),
	RESOURCES_COUNT("resources_count", "申报资源目录数", "varchar", true, "input", true, new HashMap<String, String>(), true,
			true),
	STATE("state", "启用状态", "varchar", true, "input", true, new HashMap<String, String>(){

		/**
		 * 
		 */
		private static final long serialVersionUID = 1754840501861781719L;
		{
			put("1", "启用");
			put("2", "停用");
		}
		
	}, true,
			true),
	ROOT_ID("root_id", "主体类型", "varchar", true, "input", true, new HashMap<String, String>(){
		
		/**
		 * 
		 */
		private static final long serialVersionUID = -7959889316859684412L;

		{
			put("100000", "法人库");
			put("100001", "自然人库");
			put("100002", "非企业法人库");
		}

}, true,
			true),
	UPDATE_PERSON("update_person", "更新人", "varchar", true, "input", true, new HashMap<String, String>(), true,true),
	UPDATETIME("updatetime", "更新时间", "timestamp", true, "input", true, new HashMap<String, String>(), true,
			true);
	
	private String colNameEN;
	private String colNameCN;
	private String type;
	private boolean defaultShow;
	private String widget;
	private boolean fuzzy;
	private HashMap<String, String> widgetValue;
	private boolean searchIsShow;
	private boolean advanceConditionShow;
	
	
	private DeclarationManagementEnum(String colNameEN, String colNameCN, String type, boolean defaultShow, String widget,
			boolean fuzzy, HashMap<String, String> widgetValue, boolean searchIsShow, boolean advanceConditionShow) {
		this.colNameEN = colNameEN;
		this.colNameCN = colNameCN;
		this.type = type;
		this.defaultShow = defaultShow;
		this.widget = widget;
		this.fuzzy = fuzzy;
		this.widgetValue = widgetValue;
		this.searchIsShow = searchIsShow;
		this.advanceConditionShow = advanceConditionShow;
	}
	public String getColNameEN() {
		return colNameEN;
	}
	public void setColNameEN(String colNameEN) {
		this.colNameEN = colNameEN;
	}
	public String getColNameCN() {
		return colNameCN;
	}
	public void setColNameCN(String colNameCN) {
		this.colNameCN = colNameCN;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public boolean isDefaultShow() {
		return defaultShow;
	}
	public void setDefaultShow(boolean defaultShow) {
		this.defaultShow = defaultShow;
	}
	public String getWidget() {
		return widget;
	}
	public void setWidget(String widget) {
		this.widget = widget;
	}
	public boolean isFuzzy() {
		return fuzzy;
	}
	public void setFuzzy(boolean fuzzy) {
		this.fuzzy = fuzzy;
	}
	public HashMap<String, String> getWidgetValue() {
		return widgetValue;
	}
	public void setWidgetValue(HashMap<String, String> widgetValue) {
		this.widgetValue = widgetValue;
	}
	public boolean isSearchIsShow() {
		return searchIsShow;
	}
	public void setSearchIsShow(boolean searchIsShow) {
		this.searchIsShow = searchIsShow;
	}
	public boolean isAdvanceConditionShow() {
		return advanceConditionShow;
	}
	public void setAdvanceConditionShow(boolean advanceConditionShow) {
		this.advanceConditionShow = advanceConditionShow;
	}
	
	public static List<OptionalColumn> getOptionalColumns() {

		List<OptionalColumn> OptionalColumns = new ArrayList<OptionalColumn>();
		DeclarationManagementEnum[] values = DeclarationManagementEnum.values();
		for (DeclarationManagementEnum value : values) {
			OptionalColumn optionalColumn = new OptionalColumn(value.getColNameEN(), value.getColNameCN(),
					value.getType(), value.isDefaultShow(), value.getWidget(), value.isFuzzy(), value.getWidgetValue(),
					value.isSearchIsShow());
			OptionalColumns.add(optionalColumn);
		}
		return OptionalColumns;
	}

	public static List<String> getDefaultShowColumnEN() {
		List<String> columns = new ArrayList<String>();
		DeclarationManagementEnum[] values = DeclarationManagementEnum.values();
		for (DeclarationManagementEnum value : values) {
			if (value.isDefaultShow()) {
				columns.add(value.getColNameEN());
			}
		}
		return columns;
	}

	public static List<OptionalColumn> getAdvancedConditionColumns() {
		List<OptionalColumn> OptionalColumns = new ArrayList<OptionalColumn>();
		DeclarationManagementEnum[] values = DeclarationManagementEnum.values();
		for (DeclarationManagementEnum value : values) {
			if (value.isAdvanceConditionShow()) {
				OptionalColumn optionalColumn = new OptionalColumn(value.getColNameEN(), value.getColNameCN(),
						value.getType(), value.isDefaultShow(), value.getWidget(), value.isFuzzy(),
						value.getWidgetValue(), value.isSearchIsShow());
				OptionalColumns.add(optionalColumn);
			}
		}
		return OptionalColumns;
	}

}
